package com.huawei.hianalytics.ab.bc.kl;

import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;

public class ab {
    private byte[] ab;
    private int bc;
    private int cd;

    public ab() {
        this.ab = null;
        this.bc = WXMediaMessage.DESCRIPTION_LENGTH_LIMIT;
        this.cd = 0;
        this.ab = new byte[this.bc];
    }

    public ab(int i) {
        this.ab = null;
        this.bc = WXMediaMessage.DESCRIPTION_LENGTH_LIMIT;
        this.cd = 0;
        this.bc = i;
        this.ab = new byte[i];
    }

    public int ab() {
        return this.cd;
    }

    public void ab(byte[] bArr, int i) {
        if (i > 0) {
            if (this.ab.length - this.cd >= i) {
                System.arraycopy(bArr, 0, this.ab, this.cd, i);
            } else {
                Object obj = new byte[((this.ab.length + i) << 1)];
                System.arraycopy(this.ab, 0, obj, 0, this.cd);
                System.arraycopy(bArr, 0, obj, this.cd, i);
                this.ab = obj;
            }
            this.cd += i;
        }
    }

    public byte[] bc() {
        if (this.cd <= 0) {
            return new byte[0];
        }
        Object obj = new byte[this.cd];
        System.arraycopy(this.ab, 0, obj, 0, this.cd);
        return obj;
    }
}
